package com.thinkingstar.iads.common.tree.vo;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;

import com.thinkingstar.iads.datacenter.entity.DcProjectDesignCell;

import org.apache.poi.ss.formula.functions.T;
import org.nutz.lang.util.NutMap;

import com.thinkingstar.iads.cs.sys.enumerate.PROJECT_DESIGN_COURSE;
import com.thinkingstar.iads.cs.sys.enumerate.PROJECT_DESIGN_TYPE;
import com.thinkingstar.iads.datacenter.entity.DcProjectMentionInformation;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 公共节点树
 * @author Administrator
 *
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommonTreeVO <T>{
	
	protected String name; //节点名称
	
	protected String xurl; //节点链接(可选),未设置则不会跳转
	
	protected String node_id; //自定义参数,当前节点id
	
	protected Boolean isParent = false; //是否是父节点(默认无子节点)
	
	protected String node_code; //自定义参数,节点code
	
	protected String node_type; //节点类型
	
	protected static final String TREE_TOP = "0001";
	
	protected Boolean open = false; //是否展开默认false
	
	protected List<T> children = new ArrayList<>();
	
	//初始化上层菜单树
	public CommonTreeVO(PROJECT_DESIGN_COURSE obj){
		this.xurl = obj.getUrl();
		this.name = obj.getDesc();
		this.node_code = obj.getCode();
		this.node_type = PROJECT_DESIGN_TYPE.设计过程.getDesc();
	}
	
	public CommonTreeVO(DcProjectMentionInformation obj){
		this.node_id = obj.getId();
		this.name = obj.getMention_information_name();
		this.node_code = obj.getMention_information_code();
		this.node_type = PROJECT_DESIGN_TYPE.设计资料.getDesc();
	}
	
	public static List<CommonTreeVO> getList(List <PROJECT_DESIGN_COURSE> list){
		List <CommonTreeVO> result_list = new ArrayList<>();
		for(PROJECT_DESIGN_COURSE data : list){
			result_list.add(new CommonTreeVO(data));
		}
		return result_list;
	}
	
	public static List<CommonTreeVO> getMentionList(List <DcProjectMentionInformation> list){
		List <CommonTreeVO> result_list = new ArrayList<>();
		for(DcProjectMentionInformation data : list){
			result_list.add(new CommonTreeVO(data));
		}
		return result_list;
	}


}
